home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacTech 1 to 12
/
MacTech-vol-1-12.toast
/
Reference
/
the cmsp digests ('94-'97)
/
csmp digest Vol 3 No 078
< prev
next >
Wrap
Internet Message Format
|
1995-01-06
|
64KB
From: pottier@clipper.ens.fr (Francois Pottier)
Subject: csmp-digest-v3-078
To: csmp-digest@ens.fr
Date: Fri, 6 Jan 1995 14:55:12 +0100 (MET)
Mime-Version: 1.0
Reply-To: pottier@clipper.ens.fr
X-Sequence: 84
C.S.M.P. Digest Fri, 06 Jan 95 Volume 3 : Issue 78
Today's Topics:
64-bit math: "Int64Bit"? "comp"? "wide"? wtf??
Accessing &qd.arrow from a Power PC code resource?
How do I output a hairline line to the printer?
Introduction to object-oriented programming?
Memory management in C ?
Recordable applications
Transparent PICTs?
The Comp.Sys.Mac.Programmer Digest is moderated by Francois Pottier
(pottier@clipper.ens.fr).
The digest is a collection of article threads from the internet newsgroup
comp.sys.mac.programmer. It is designed for people who read c.s.m.p. semi-
regularly and want an archive of the discussions. If you don't know what a
newsgroup is, you probably don't have access to it. Ask your systems
administrator(s) for details. If you don't have access to news, you may
still be able to post messages to the group by using a mail server like
anon.penet.fi (mail help@anon.penet.fi for more information).
Each issue of the digest contains one or more sets of articles (called
threads), with each set corresponding to a 'discussion' of a particular
subject. The articles are not edited; all articles included in this digest
are in their original posted form (as received by our news server at
nef.ens.fr). Article threads are not added to the digest until the last
article added to the thread is at least two weeks old (this is to ensure that
the thread is dead before adding it to the digest). Article threads that
consist of only one message are generally not included in the digest.
The digest is officially distributed by two means, by email and ftp.
If you want to receive the digest by mail, send email to listserv@ens.fr
with no subject and one of the following commands as body:
help Sends you a summary of commands
subscribe csmp-digest Your Name Adds you to the mailing list
signoff csmp-digest Removes you from the list
Once you have subscribed, you will automatically receive each new
issue as it is created.
The official ftp info is //ftp.dartmouth.edu/pub/csmp-digest.
Questions related to the ftp site should be directed to
scott.silver@dartmouth.edu. Currently no previous volumes of the CSMP
digest are available there.
Also, the digests are available to WAIS users. To search back issues
with WAIS, use comp.sys.mac.programmer.src. With Mosaic, use
http://www.wais.com/wais-dbs/comp.sys.mac.programmer.html.
-------------------------------------------------------
>From first.ascent@mindlink.bc.ca (Alex Curylo)
Subject: 64-bit math: "Int64Bit"? "comp"? "wide"? wtf??
Date: 22 Dec 1994 11:18:01 GMT
Organization: First Ascent
So I need to port this 64-bit integer math library from handcrafted
Windows assembly code (yuck! ptoo!), so I went looking for what kind of
Toolbox support there is for 64-bit integers, and I'm all confused now.
1) LongMul() multiplies two longs into a signed "Int64Bit". This
appears to be the only place in the known universe that this type
appears.
2) SANE has the signed "comp" type. But it seems to be short on things
to do with it, you seem to have to convert to extended to do much
interesting. Unless I'm missing something.
3) CodeWarrior's Types.h includes the perfect-appearing "wide" and
"UnsignedWide" types. But I've never heard of these, and they don't
appear in my Symantec or MPW Types.h, or anywhere else obvious.
Hmmmmmm.
Can somebody tell me how all this fits together, and what the best way
to do 64-bit integer math is?
+++++++++++++++++++++++++++
>From ensign@xmission.com (Ensign.CustSupport)
Date: 22 Dec 1994 07:13:21 -0700
Organization: XMission Public Access Internet (801-539-0900)
Try looking at the PowerPC manual "IM PowerPC Numerics." It should offer
some help.
I believe that "comp" was converted to "extended" on a 68K machine and
that the 68K machine was most efficient while using "extended." But that
is not the way it is on the PowerMac. Doubles are used extensively on the
PowerMac and "wide" will need a separate math library all its own. If
somebody knows of a "wide" library of functions, other than what is
already given, I would like to know about it.
Norman Parker
ensign@xmission.com
Alex Curylo
(first.ascent@mindlink.bc.ca) wrote:
: So I need to port this 64-bit integer math library from handcrafted
: Windows assembly code (yuck! ptoo!), so I went looking for what kind of
: Toolbox support there is for 64-bit integers, and I'm all confused now.
: 1) LongMul() multiplies two longs into a signed "Int64Bit". This
: appears to be the only place in the known universe that this type
: appears.
: 2) SANE has the signed "comp" type. But it seems to be short on things
: to do with it, you seem to have to convert to extended to do much
: interesting. Unless I'm missing something.
: 3) CodeWarrior's Types.h includes the perfect-appearing "wide" and
: "UnsignedWide" types. But I've never heard of these, and they don't
: appear in my Symantec or MPW Types.h, or anywhere else obvious.
: Hmmmmmm.
: Can somebody tell me how all this fits together, and what the best way
: to do 64-bit integer math is?
+++++++++++++++++++++++++++
>From ax52@cityscape.co.uk (Giuliano Gavazzi)
Date: 22 Dec 1994 20:39:04 GMT
Organization: CityScape Internet Sevices
In article <3dc1i1$fs0@xmission.xmission.com>, ensign@xmission.com
(Ensign.CustSupport) wrote:
> Try looking at the PowerPC manual "IM PowerPC Numerics." It should offer
> some help.
...
> Norman Parker
> ensign@xmission.com
>
> Alex Curylo
> (first.ascent@mindlink.bc.ca) wrote:
...
> : Can somebody tell me how all this fits together, and what the best way
> : to do 64-bit integer math is?
to my knowledge "IM PowerPC Numerics" tells only about floating
point types. I am also interested in 64 bit integer math, and thus repeat:
is there a way to di it without going to assembler or defining a new class.
Giuliano Gavazzi
+++++++++++++++++++++++++++
>From Jens Alfke <jens_alfke@powertalk.apple.com>
Date: Thu, 22 Dec 1994 19:00:48 GMT
Organization: Apple Computer
Alex Curylo, first.ascent@mindlink.bc.ca writes:
> 3) CodeWarrior's Types.h includes the perfect-appearing "wide" and
> "UnsignedWide" types. But I've never heard of these, and they don't
> appear in my Symantec or MPW Types.h, or anywhere else obvious.
> Hmmmmmm.
These are used by the wide math routines for PowerPC, defined in FixMath.h.
Unfortunately these routines only exist on PowerMacs. However, I believe
they're not too hard to implement on 68020 and higher...
--Jens Alfke jens_alfke@powertalk.apple.com
"A man, a plan, a yam, a can of Spam ... Bananama!"
---------------------------
>From dpbsmith@world.std.com (Daniel P. B. Smith)
Subject: Accessing &qd.arrow from a Power PC code resource?
Date: Thu, 8 Dec 1994 02:58:43 GMT
Organization: The World Public Access UNIX, Brookline, MA
I'm tinkering with a Mac code resource, which is a kind of "plug-in"
for an application. It is a "fat" resource that contains both 68K and
PPC code versions. I'm trying to arrange for an hourglass cursor to
appear during a time-consuming operation. I have no problem with
SetCursor(GetCursor(watchCursor)), but I can't quite figure out how
to get it back to being an arrow. In the 68K code you'd use
SetCursor(&qd.arrow) (I'm typing this from memory, away from my reference
material so if it's really SetCursor(qd.arrow) or SetCursor(qd->arrow)
don't flame me), but it's not clear how you can get at the QuickDraw
globals in a PPC code resource. Inside Mac seems to suggest that you
choose any little chunk of memory to be the QuickDraw global area and
you MAKE it the QuickDraw global area when you call InitGraf. All
well and good, but it's the _main application_ that does that, not me!
(And I don't have source, or even object code, for the main application).
>From a PowerPC code resource, how can I get to either a) an arrow cursor
resource, or b) the QuickDraw global area? Is there anything more
sensible to do than build my own cursor resource that just happens to
look the same as the genuine arrow cursor and put it in a resource file?
--
Daniel P. B. Smith
dpbsmith@world.std.com
+++++++++++++++++++++++++++
>From bobschaaf@aol.com (Bobschaaf)
Date: 9 Dec 1994 20:55:19 -0500
Organization: America Online, Inc. (1-800-827-6364)
In article <D0H1Lv.AB3@world.std.com>, dpbsmith@world.std.com (Daniel P.
B. Smith) writes:
>I have no problem with
>SetCursor(GetCursor(watchCursor)), but I can't quite figure out how
>to get it back to being an arrow.
Just call InitCursor().
The only problem would be that is resets ths cursor level to 0.
>From Phoenix,
Bob Schaaf
+++++++++++++++++++++++++++
>From Chris Watson <cwatson@cam.org>
Date: 12 Dec 1994 20:53:27 GMT
Organization: -
In article <3cb1q7$a8f@newsbf01.news.aol.com> Bobschaaf,
bobschaaf@aol.com writes:
>In article <D0H1Lv.AB3@world.std.com>, dpbsmith@world.std.com (Daniel P.
>B. Smith) writes:
>
>>I have no problem with
>>SetCursor(GetCursor(watchCursor)), but I can't quite figure out how
>>to get it back to being an arrow.
>
>Just call InitCursor().
>The only problem would be that is resets ths cursor level to 0.
Perhaps I do not understand fully what you are trying to do, but to set
the cursor to the standard arrow, just use:
SetCursor (&qd.arrow);
This is how I do it in my program, and it works on 68k and ppc....
Sorry if I misunderstood; good luck.
+++++++++++++++++++++++++++
>From Jens Alfke <jens_alfke@powertalk.apple.com>
Date: Thu, 22 Dec 1994 19:28:16 GMT
Organization: Apple Computer
Chris Watson, cwatson@cam.org writes:
> Perhaps I do not understand fully what you are trying to do, but to set
> the cursor to the standard arrow, just use:
> SetCursor (&qd.arrow);
> This is how I do it in my program, and it works on 68k and ppc....
It works fine if your code originally called InitGraf, so the QD globals are
living in your "qd" global variable. If you didn't, i.e. you are a code
resource or shared lib, you can't do this.
The way to do it is to use the fact that the longword at A5 is a pointer to
the variable qd.thePort; by dereferencing A5 and subtracting the appropriate
offset -- sizeof(QDGlobals) - sizeof(GrafPtr) -- you can recover a pointer to
the globals. I have a snippet that does this but I can't find it right now...
Yes, this works even on PPC. Even PowerMacs have A5 worlds, and calling
LMGetCurrentA5 will get you the current A5 value.
--Jens Alfke jens_alfke@powertalk.apple.com
"A man, a plan, a yam, a can of Spam ... Bananama!"
---------------------------
>From clarrob@wwc.edu (Robert LaVerne Clark)
Subject: How do I output a hairline line to the printer?
Date: 19 Dec 1994 11:46:30 -0800
Organization: Walla Walla College, College Place, WA
How can I draw a hairline-width line to the
printer? I'm successfully drawing a one-pixel-
wide line, but that's too big and fat for my
purposes.
Any ideas?
--Bob Clark (clarrob@wwc.edu)
+++++++++++++++++++++++++++
>From kenlong@netcom.com (Ken Long)
Date: Mon, 19 Dec 1994 21:42:05 GMT
Organization: NETCOM On-line Communication Services (408 261-4700 guest)
Robert LaVerne Clark (clarrob@wwc.edu) wrote:
: How can I draw a hairline-width line to the
: printer? I'm successfully drawing a one-pixel-
: wide line, but that's too big and fat for my
: purposes.
This was all covered (I believe) in an earlier c.s.m.p. If you consult
the digests from volume 3 you'll probably find it.
I'd say, off hand, it depends on the printer. Screen resolution is
usually 72 dpi. A StyleWriter is 360 dpi, which is 1/5th sreen res.
Therefore, if the printer draws a pixel, the printed pixel is 25x25 jet
squirts. The StyeWriter (I or II) has an adjustment for scale
percentage. If I draw a 72 dpi line-art in Color It! and scale it up
500%, then it will "smooth scale" it - which means it takes one pixel and
widens and fades (blurs) it out from the center of the pixel. So the
center new pixel is black and it grayscales out 5 pixels in both
directions to the background color.
so, from white, 5 darker pixels to blak, then 5 lighter pixel back to
white, in both directions (h, v).
Then, I'll remove all but the black pixels and print it at 360 dpi. The
result is a 72 dpi printout using 360 dpi pixels. In other words, I
scale it up 5 times, remove all but the black pixels and print and all
the "pixel" sixes are 1/5th their original size on the page, or one jet
suirt wide.
But it seems you want to do this with only a portion of the printout. True?
-Ken-
+++++++++++++++++++++++++++
>From scouten@metrowerks.com (Eric Scouten)
Date: Mon, 19 Dec 1994 19:28:23 -0600
Organization: metrowerks, inc.
Robert LaVerne Clark (clarrob@wwc.edu) wrote:
: How can I draw a hairline-width line to the
: printer? I'm successfully drawing a one-pixel-
: wide line, but that's too big and fat for my
: purposes.
To which kenlong@netcom.com (Ken Long) responded:
[most of instructions deleted]
> percentage. If I draw a 72 dpi line-art in Color It! and scale it up
> 500%, then it will "smooth scale" it - which means it takes one pixel and
> widens and fades (blurs) it out from the center of the pixel.
I'm not sure, but I think you have misinterpreted the question. I'm
assuming (since this is in c.s.m.programmer.help) that Robert is wishing
to draw hairlines directly from his program, rather than from some
graphics program. Given that interpretation, here's my answer:
What you really need to know is the SetLineWidth PICT comment. It's a
rather strange and awkward beast, but it's your only choice unless you
want to write straight PostScript. The best description of it can be found
in Tech Note PR12. If you have WWW access, you can find it at:
http://www.info.apple.com/dev/technotes/Printing/pr_12.html
Basically it works something like this:
Handle itsWidthPoint = NewHandle(sizeof (Point));
SetPt((Point *) *itsWidthPoint, 4, 1);
PicComment(SetLineWidth, sizeof(Point), itsWidthPoint);
>From this point on, until the next SetLineWidth comment, line widths are
multiplied by 1/4 (or whatever values you plug into the SetPt command).
This works equally well for QuickDraw printers (ImageWriter, StyleWriter,
etc.) as PostScript (most LaserWriters).
Read the Tech Note *carefully* before using it; there are some rather
strange caveats.
-es
__________________________________________________________________________
Eric Scouten Constructor Constructor
scouten@metrowerks.com Metrowerks, Inc.
**** ON VACATION Dec 21 - Jan 8: LIMITED NET ACCESS ****
I saw John Norstad with Elvis! And they were varnishing waffles!
-Peter Cohen <flargh@tiac.net>
+++++++++++++++++++++++++++
>From lawa@bbsrc.ac.uk (Andy Law (Big Nose))
Date: 22 Dec 1994 11:14:40 GMT
Organization: Roslin Institute
> Robert LaVerne Clark (clarrob@wwc.edu) wrote:
> : How can I draw a hairline-width line to the
> : printer? I'm successfully drawing a one-pixel-
> : wide line, but that's too big and fat for my
> : purposes.
>
I think (but I've never done it so don't quote me) that you need to
incorporate PictureComments into your drawing set up. There is one comment
that scales the size of the line to be drawn. I seem to remember some
discussion about problems with scaling in that different printers dealt
with the situation differently, but there was some generalised solution to
it all.
Try a WAIS search of the csmp archives to see if you can pull it out.
--
Andy Law
( Lawa @ bbsrc.ac.uk Big Nose in Edinburgh )
---------------------------
>From dimento@cs.tu-berlin.de (Christian Moskal)
Subject: Introduction to object-oriented programming?
Date: 17 Dec 1994 07:03:05 GMT
Organization: Technical University of Berlin, Germany
Hello --
I am looking for a good introduction to basic principles of object oriented
programming languages such as C++ for a friend of mine.
Any pointers will be greatly appreciated.
Best
-- Chris
--
I'd rather learn from one bird how to sing
than teach ten thousand stars how not to dance
+++++++++++++++++++++++++++
>From jim@MCS.COM (Reverend Jim Mines)
Date: 17 Dec 1994 08:17:31 -0600
Organization: The Church Of Digital Splendor
Christian Moskal (dimento@cs.tu-berlin.de) wrote:
: Hello --
: I am looking for a good introduction to basic principles of object oriented
: programming languages such as C++ for a friend of mine.
: Any pointers will be greatly appreciated.
: Best
: -- Chris
: --
: I'd rather learn from one bird how to sing
: than teach ten thousand stars how not to dance
--
I'm learning c++/oop with "Simple C++" by Jeffrey M. Cogswell
(ISBN #1-878739-44-1).
It's easy to read, but doesn't seem to insult me like the
'dummies' books do. It explains OOP very well, and I've never programmed
a thing in my life!!!
Reverend Jim Mines (jim@mcs.com)
__///////\ The Church of Digital Splendor /\\\\\\\__
\\\\\\\/ http://www.mcs.com/~jim/cds.html \///////
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+++++++++++++++++++++++++++
>From stanleyr@acf4.nyu.edu (Rick Stanley)
Date: 17 Dec 1994 16:16:16 GMT
Organization: New York University
dimento@cs.tu-berlin.de (Christian Moskal) writes:
>Hello --
>I am looking for a good introduction to basic principles of object oriented
>programming languages such as C++ for a friend of mine.
>Any pointers will be greatly appreciated.
Purchase a copy of the following book:
"Object-Oriented Analysis And Design, With Applications" 2nd edition
Grady Booch, Author
The Benjamin/Cummings Publishing Co., Inc.
ISBN # 0-8053-5340-2
--
Rick Stanley | RSI
stanleyr@acf4.nyu.edu | (212) 740-6600
Information Technologies Institute | C++ & C Language
New York University NYC, NY USA | Programming, Training, Consulting
+++++++++++++++++++++++++++
>From pjl@graceland.att.com (Paul J. Lucas)
Date: Sat, 17 Dec 1994 12:32:33 GMT
Organization: AT&T
In <dimento-1712940815550001@130.149.1.104> dimento@cs.tu-berlin.de (Christian Moskal) writes:
>I am looking for a good introduction to basic principles of object oriented
>programming languages such as C++ for a friend of mine.
>Any pointers will be greatly appreciated.
There's the famous "What is" paper by Bjarne:
Stroustrup, Bjarne. "What is Object-Oriented
Programming?" IEEE Software, vol. 5, May 1988,
pp. 10-20.
The beginning of The C++ Programming Language also has a nice
explanation as well as a comparison with other methodologies.
For a more general intorduction, there's also a book by Timothy
Budd -- blue book with a platypus on the cover...can't remember
the name. Hopefully, somebody out there in net-land will know.
--
- Paul J. Lucas
AT&T Bell Laboratories
Naperville, IL
+++++++++++++++++++++++++++
>From howardb@enlil.premenos.com (Howard Berkey)
Date: 18 Dec 1994 02:09:14 GMT
Organization: Premenos Corp.
In article <dimento-1712940815550001@130.149.1.104>,
Christian Moskal <dimento@cs.tu-berlin.de> wrote:
>Hello --
>
>I am looking for a good introduction to basic principles of object oriented
>programming languages such as C++ for a friend of mine.
>
>Any pointers will be greatly appreciated.
>
>
A book I like is "Object oriented programming - An evolutionary
approach" by Cox and Novbilsky. It centers around objective C (the
authors are/were principals of Stepstone) but it is applicable to any
OO language. It is not a book for beginning programmers, however. It
is pretty in-depth.
Also, Grady Booch has a book that everyone seems to like (the title
escapes me, I don't own it).
Good luck,
--
Howard Berkey howardb@premenos.com
Windows '95 == Macintosh '84
+++++++++++++++++++++++++++
>From garyg@oak.circa.ufl.edu (gary greenberg)
Date: 18 Dec 1994 03:21:19 GMT
Organization: Center for Instructional and Research Computing Activities
In article <3d05ka$gqu@tortosa.templar.net>, howardb@enlil.premenos.com (Howard Berkey) writes:
>In article <dimento-1712940815550001@130.149.1.104>,
>Christian Moskal <dimento@cs.tu-berlin.de> wrote:
>>Hello --
>>
>>I am looking for a good introduction to basic principles of object oriented
>>programming languages such as C++ for a friend of mine.
>>
>>Any pointers will be greatly appreciated.
>>
>>
>
>A book I like is "Object oriented programming - An evolutionary
>approach" by Cox and Novbilsky. It centers around objective C (the
>authors are/were principals of Stepstone) but it is applicable to any
>OO language. It is not a book for beginning programmers, however. It
>is pretty in-depth.
A basic yet excellent introduction to OO (using Smalltalk to illustrate the
principles as explained) is:
Concpts of Object-Oriented Programming by David N. Smith, McGraw-Hill, Inc.
1991. ISBN - 0-07-059177-6. I read this when I was thinking about learning
to program, before I had ever even attempted to write a line of code. It helped
convince me that this would be fun. Although I'm still a neophyte, and couldn't
_yet_ find the errors in most posted code, I can say you'll enjoy this book &&
get lot's out of it.
btw, the programmer who recommended it to me has been a smalltalker for about
12 years and he used it for a class he taught to newbies.
Moreover, to all the wizards out there who donate their time to help us
learn && enable us to "stand on the shoulders of those who came before"
Happy Holidays To ALL!!
Cheers,
gary
+++++++++++++++++++++++++++
>From AST@postman.hsn.no (Alf P. Steinbach)
Date: Sun, 18 Dec 1994 05:58:58 GMT
Organization: Nordland College
In article <3cv2sg$7o3@cmcl2.NYU.EDU> stanleyr@acf4.nyu.edu (Rick Stanley) writes:
>Xref: news.uit.no comp.lang.c++:92640 comp.lang.misc:15178 comp.sys.mac.programmer:106665 comp.sys.mac.programmer.help:1188 comp.sys.newton.misc:20817 rec.arts.books:107462 rec.arts.books.marketplace:5041
>Path: news.uit.no!trane.uninett.no!sunic!pipex!howland.reston.ans.net!math.ohio-state.edu!uwm.edu!rutgers!mcrcr6!cmcl2!acf4!stanleyr
>Newsgroups: comp.lang.c++,comp.lang.misc,comp.sys.mac.programmer,comp.sys.mac.programmer.help,comp.sys.newton.misc,rec.arts.books,rec.arts.books.marketplace
>Subject: Re: Introduction to object-oriented programming?
>Message-ID: <3cv2sg$7o3@cmcl2.NYU.EDU>
>From: stanleyr@acf4.nyu.edu (Rick Stanley)
>Date: 17 Dec 1994 16:16:16 GMT
>References: <dimento-1712940815550001@130.149.1.104>
>Organization: New York University
>NNTP-Posting-Host: acf4.nyu.edu
>X-Newsreader: NN version 6.5.0 #5 (NOV)
>Lines: 21
>dimento@cs.tu-berlin.de (Christian Moskal) writes:
>
>>Hello --
>
>>I am looking for a good introduction to basic principles of object oriented
>>programming languages such as C++ for a friend of mine.
>
>>Any pointers will be greatly appreciated.
>
>Purchase a copy of the following book:
>
>"Object-Oriented Analysis And Design, With Applications" 2nd edition
>Grady Booch, Author
>The Benjamin/Cummings Publishing Co., Inc.
>ISBN # 0-8053-5340-2
>
>--
>Rick Stanley | RSI
>stanleyr@acf4.nyu.edu | (212) 740-6600
>Information Technologies Institute | C++ & C Language
>New York University NYC, NY USA | Programming, Training, Consulting
Also consider the original "Smalltalk-80: the language and its
implementation" (Golberg & Robson, Addison Wesley) as supplementary
literature - this book was my introduction to OOP, and it's great: much
info, discussion of the Smalltalk app framework, and historical interest.
For a main text, consider the Eiffel book: it's very clear, very lucid,
and covers high-level ideas and design issues as well as practical
techniques and the language support. But what was the name of the book?
+++++++++++++++++++++++++++
>From bb@lightside.com (Bob Bradley)
Date: Sat, 17 Dec 1994 22:51:45 -0800
Organization: SS Software Inc.
The best book I've seen on Mac Object Programming is Element of C++
Macintosh Programming by Dan Weston. It's a easy book to read that goes
thru what you need to know to to use C++ on the Mac. It goes thru creating
an Application and various Window classes to make a Mac application and
more.
+++++++++++++++++++++++++++
>From brianm@csa.bu.edu (Brian Mancuso)
Date: 18 Dec 1994 22:25:49 GMT
Organization: Computer Science Department, Boston University, Boston, MA, USA
stanleyr@acf4.nyu.edu (Rick Stanley) writes:
| dimento@cs.tu-berlin.de (Christian Moskal) writes:
|
| Purchase a copy of the following book:
|
| "Object-Oriented Analysis And Design, With Applications" 2nd edition
| Grady Booch, Author
| The Benjamin/Cummings Publishing Co., Inc.
| ISBN # 0-8053-5340-2
|
I second this motion; this book tends to be the definitive
introductory text to object-oriented programming methodologies. One of
the key strengths of this book is the fact that it takes into
consideration a significant number of the object-oriented styles that
historically have been significant.
Brian Mancuso
| "Computation is the art of carefully throwing away information." |
| Boston University Computer Science Dept. |
| Tel: 617.352.8685 Net: brianm@cs.bu.edu |
| Pgp Public Key Avail. Member of the LPF. |
+++++++++++++++++++++++++++
>From quinn@cs.uwa.edu.au (Quinn "The Eskimo!")
Date: Mon, 19 Dec 1994 11:47:40 +0800
Organization: Department of Computer Science, University of Western Australia
In article <AST.200.787730338@postman.hsn.no>, AST@postman.hsn.no (Alf P.
Steinbach) wrote:
>For a main text, consider the Eiffel book: it's very clear, very lucid,
>and covers high-level ideas and design issues as well as practical
>techniques and the language support. But what was the name of the book?
Well there's two...
"Object Oriented Software Construction"
...and...
"Eiffel: The Language"
... both by Betrand Meyer. Both are very good IMHO.
--
Quinn "The Eskimo!" "Ah ha, the carnage begins!"
+++++++++++++++++++++++++++
>From zhou0024@eel.micro.umn.edu (CHENGCHEN ZHOU)
Date: Mon, 19 Dec 1994 22:17:09 GMT
Organization: University of Minnesota, Minneapolis: Under Grad Workstation Lab.
In <3curtr$17u@Mars.mcs.com> jim@MCS.COM (Reverend Jim Mines) writes:
>Christian Moskal (dimento@cs.tu-berlin.de) wrote:
>: Hello --
>: I am looking for a good introduction to basic principles of object oriented
>: programming languages such as C++ for a friend of mine.
>: Any pointers will be greatly appreciated.
I just bought the book titled "Design Patterns" by Gamma et.el,
it categorized certain OOD ideas and explained them using concerete examples.
I dislike the so called "OO methodology"s, but like this book.
"OOP should be a pratical discipline".
D. Yue
+++++++++++++++++++++++++++
>From bw16@cornell.edu (Bretton Wade)
Date: Mon, 19 Dec 1994 20:56:11 -0500
Organization: Cornell Program of Computer Graphics
try this one out too:
http://info.desy.de/gna/html/cc/index.html
In article <dimento-1712940815550001@130.149.1.104>,
dimento@cs.tu-berlin.de (Christian Moskal) wrote:
> Hello --
>
> I am looking for a good introduction to basic principles of object oriented
> programming languages such as C++ for a friend of mine.
>
> Any pointers will be greatly appreciated.
_____________________________________________________________________
Bretton Wade (bw16@cornell.edu)
http://www.graphics.cornell.edu/~bwade/
_____________________________________________________________________
+++++++++++++++++++++++++++
>From Brian_Mancuso,brianm-csa.bu.edu,Internet@adbbs.antioch.edu (Brian Mancuso,brianm@csa.bu.edu,Internet)
Date: 18 Dec 1994 22:25:49 GMT
Organization: Apple Dayton User's Group's BBS
stanleyr@acf4.nyu.edu (Rick Stanley) writes:
| dimento@cs.tu-berlin.de (Christian Moskal) writes:
|
| Purchase a copy of the following book:
|
| "Object-Oriented Analysis And Design, With Applications" 2nd edition
| Grady Booch, Author
| The Benjamin/Cummings Publishing Co., Inc.
| ISBN # 0-8053-5340-2
|
I second this motion; this book tends to be the definitive
introductory text to object-oriented programming methodologies. One of
the key strengths of this book is the fact that it takes into
consideration a significant number of the object-oriented styles that
historically have been significant.
Brian Mancuso
| "Computation is the art of carefully throwing away information." |
| Boston University Computer Science Dept. |
| Tel: 617.352.8685 Net: brianm@cs.bu.edu |
| Pgp Public Key Avail. Member of the LPF. |
+++++++++++++++++++++++++++
>From "Alexander Rxdsten" <siv910111@vm.bi.no>
Date: 21 Dec 1994 10:18:01 GMT
Organization: UniNett
dimento@cs.tu-berlin.de (Christian Moskal) wrote:
>
> Hello --
>
> I am looking for a good introduction to basic principles of object oriented
> programming languages such as C++ for a friend of mine.
>
> Any pointers will be greatly appreciated.
>
>
> Best
> -- Chris
>
> --
> I'd rather learn from one bird how to sing
> than teach ten thousand stars how not to dance
Suggestion: "OOP" P. Coad & J.Nicola,
Yourdon Press Computing Series, 1993
---------------------------
>From fh3ar@aixterm1.urz.uni-heidelberg.de (Marc Steinbach)
Subject: Memory management in C ?
Date: 19 Dec 1994 10:35:25 -0600
Organization: UTexas Mail-to-News Gateway
Hello,
we're looking for an automatic memory management which is handled
by a garbage collection and written in C for use in C-code.
Especially for use with Apple Macs, Windows-based machines and
Sun Sparc running under Solaris.
Thanks for advice.
marc
PS: Happy Christmas
+++++++++++++++++++++++++++
>From gdr11@cl.cam.ac.uk (Gareth Rees)
Date: 20 Dec 1994 05:03:57 GMT
Organization: U of Cambridge Computer Lab, UK
Marc Steinbach (fh3ar@aixterm1.urz.uni-heidelberg.de) writes:
> We're looking for an automatic memory management which is handled by
> garbage collection and written in C for use in C-code.
Such a beast can't be implemented as a portable C library for use by C
code, because garbage collection is implementation specific. Consider:
(1) How is the garbage collector to distinguish between pointers and
other data, when it is marking/collecting the heap? Compilers for
languages with garbage collection must tag pointers in some way so as to
make them distinctive. A garbage collector for a C program must
therefore have detailed knowledge of the structures in the heap so that
it can trace them.
(2) How is the garbage collector going to identify pointers into the
heap? It has to examine the stack, all global variables, and any
variables in registers. Again, this depends upon detailed knowledge
about the implementation of the compiler.
+++++++++++++++++++++++++++
>From Lars.Farm@nts.mh.se (Lars Farm)
Date: Tue, 20 Dec 1994 16:20:00 +0100
Organization: Mid Sweden University
In article <3d5ojt$omi@lyra.csx.cam.ac.uk>, gdr11@cl.cam.ac.uk (Gareth
Rees) wrote:
> Marc Steinbach (fh3ar@aixterm1.urz.uni-heidelberg.de) writes:
> > We're looking for an automatic memory management which is handled by
> > garbage collection and written in C for use in C-code.
>
> Such a beast can't be implemented as a portable C library for use by C
> code, because garbage collection is implementation specific. Consider:
No? Check out Hans Bvhms free GC at ftp.parc.xerox.com in /pub/gc.
I can't remember the list of supported machines, but it was long. On the
Mac SC++ is supported. I made it work with MW++ (68K/4-byte int easy) It
should be equaly simple to make it work for PPC. It requires a tiny little
configuration specific support routine in PPC asm and I haven't tried that
yet. One could probably start from the (supported) RS6000.
Lars
> (1) How is the garbage collector to distinguish between pointers and
> other data, when it is marking/collecting the heap? Compilers for
> languages with garbage collection must tag pointers in some way so as to
> make them distinctive. A garbage collector for a C program must
> therefore have detailed knowledge of the structures in the heap so that
> it can trace them.
>
> (2) How is the garbage collector going to identify pointers into the
> heap? It has to examine the stack, all global variables, and any
> variables in registers. Again, this depends upon detailed knowledge
> about the implementation of the compiler.
--
Lars.Farm@nts.mh.se
+++++++++++++++++++++++++++
>From boehm@parc.xerox.com (Hans Boehm)
Date: 21 Dec 1994 02:26:02 GMT
Organization: Xerox Palo Alto Research Center
gdr11@cl.cam.ac.uk (Gareth Rees) writes:
>Marc Steinbach (fh3ar@aixterm1.urz.uni-heidelberg.de) writes:
>> We're looking for an automatic memory management which is handled by
>> garbage collection and written in C for use in C-code.
>Such a beast can't be implemented as a portable C library for use by C
>code, because garbage collection is implementation specific. Consider:
Depends on what you mean by "portable". The collector in
parcftp.xerox.com:pub/gc/gc.tar.Z has been ported to all common
workstation UN*X-like systems, win32, MacOS, OS/2 and AmigaDOS.
Admittedly it contains some conditionally compiled code.
>(1) How is the garbage collector to distinguish between pointers and
>other data, when it is marking/collecting the heap? Compilers for
>languages with garbage collection must tag pointers in some way so as to
>make them distinctive. A garbage collector for a C program must
>therefore have detailed knowledge of the structures in the heap so that
>it can trace them.
Or it can be conservative and trace through everything that looks like
a pointer. Doing so actually loses surprisingly little provided, as
always, that you get the details right. You need to restrict source
programs slightly. But the large majority of exisiting C programs
already satisfy those restrictions. (Strict ANSI conformance, plus
some restrictions on pointer IO and memcpy and friends are sufficient.)
>(2) How is the garbage collector going to identify pointers into the
>heap? It has to examine the stack, all global variables, and any
>variables in registers. Again, this depends upon detailed knowledge
>about the implementation of the compiler.
Again, a conservative scan for anything that looks like a pointer will do.
You still have to find the stack, registers, etc., which introduces
a minor OS/hardware dependency. The only compiler dependency is that
we expect the compiler not to disguise the last reference to an object.
Most (all?) compilers preserve that property for unoptimized code. (They almost
have to, if you think about the requirements imposed by a debugger.)
Some compilers (e.g. gcc) allow that property to be ensured by a
source-to-source preprocessor at small cost, even in the presence of
optimization. We have never seen a real case of a compiler not
maintaining this property, even on unprocessed, optimized code. However,
we can contrive cases that fail with optimization.
Probably the majority of compilers that use C as an intermediate language
rely on some form of conservative collection for the target code (e.g.
GCL (a.k.a. AKCL), Scheme-to-C, Bigloo, SRC Modula-3, Sather 1.0,
Cedar).
Hans-J. Boehm
(boehm@parc.xerox.com)
Standard disclaimer ...
+++++++++++++++++++++++++++
>From devon@apple.com (Devon Hubbard)
Date: Wed, 21 Dec 1994 11:11:13 -0800
Organization: Apple Computer, Inc.
In article <9412191635.AA23470@ix.urz.uni-heidelberg.de>,
fh3ar@aixterm1.urz.uni-heidelberg.de (Marc Steinbach) wrote:
> we're looking for an automatic memory management which is handled
> by a garbage collection and written in C for use in C-code.
> Especially for use with Apple Macs, Windows-based machines and
> Sun Sparc running under Solaris.
Although I've never personally used it, I've heard good stuff about a
cross platform memory management package called SmartHeap(tm) from
MicroQuill. You can use it on Windows, UNIX (Sun, HP, etc.), OS/2, NT,
Extended DOS and Macs. You can write 'devtools@microquill.win.net' for
specific information.
dEVoN
- ------------------------------------------------------------------------
Devon Hubbard Silicon Pilot
devon@apple.com Apple Computer, Inc
+++++++++++++++++++++++++++
>From h+@metrowerks.com (Jon W{tte)
Date: Wed, 21 Dec 1994 20:27:43 +0100
Organization: The Conspiracy
In article <3d5ojt$omi@lyra.csx.cam.ac.uk>,
gdr11@cl.cam.ac.uk (Gareth Rees) wrote:
>> We're looking for an automatic memory management which is handled by
>> garbage collection and written in C for use in C-code.
>Such a beast can't be implemented as a portable C library for use by C
>code, because garbage collection is implementation specific. Consider:
There's a C and C++ library from Xerox which supposedly does
this (I don't doubt it; I read the abstract and it wasn't too
hairy)
>(1) How is the garbage collector to distinguish between pointers and
>other data, when it is marking/collecting the heap? Compilers for
Surprise! It doesn't have to! Anything that looks like it could
point into an allocated memory block can be said to reference
that block, and the block is marked as referenced. All blocks
not marked after a sweep are purged. So what if a few blocks
aren't dstroyed immediately (or at all)
Oh, and the chances of actual data looking like pointers into
an allocated block and not being such pointers is actually
pretty slim!
>make them distinctive. A garbage collector for a C program must
>therefore have detailed knowledge of the structures in the heap so that
>it can trace them.
Yes, it has to have detailed knowledge of the heap. Such
knowledge IS available for the Mac memory manager heap, but the
simplest thing to do is to replace malloc() and/or ::operator
new() with your own allocator. That's not rocket science.
>(2) How is the garbage collector going to identify pointers into the
>heap? It has to examine the stack, all global variables, and any
>variables in registers. Again, this depends upon detailed knowledge
>about the implementation of the compiler.
Uh, no. As you say, it has to examine all registers, all global
variables, and all local variables on the stack. It's well
known where to find these for each system, and "portable"
doesn't mean you have to compile ALL of the same code for all
systems, just that you can move the code with relatively little
effort (like, telling a header file where the stack is and
where global data is)
Just walk the stack and global data (and all blocks
subsequently marked as referenced...) on 2-byte boundaries
(this is a 68K with short-sized ints and/or Booleans...) Then
call setjmp() to get all registers into a buffer. If setjmp()
doesn't work, write a smidgeon of assembly, and you're done.
This seems to be exactly what the Xerox gc library does, by the
way!
Cheers,
/ h+
--
Jon Wdtte (h+@metrowerks.com), Hagagatan 1, 113 48 Stockholm, Sweden
"It was, in fact, cool as all get-out. Fortunately it was a little
too late (historically speaking) to be groovy."
-- Dennis Pelton
+++++++++++++++++++++++++++
>From gurgle@dnai.com (Pete Gontier)
Date: Thu, 22 Dec 1994 14:22:54 -0700
Organization: cellular
In article <3d83nq$qvl@news.parc.xerox.com>,
boehm@parc.xerox.com (Hans Boehm) wrote:
> You still have to find the stack...
On Macintosh, an application may have several stacks, one for each
lightweight thread. Is there multiple stack support in this library?
________________________________________________________________________________
Pete Gontier -- MacZealotry, Ink. -- gurgle@dnai.com
Where do I want to go today? Anywhere but Chicago.
---------------------------
>From julian@cs.auckland.ac.nz (Julian Harris)
Subject: Recordable applications
Date: Mon, 19 Dec 1994 14:23:04 +1300
Organization: Computer Science Department, UA
Well, along with the famous net saying 'The best way to get information on
UseNet isn't to ask a question, but to post the wrong information', I'll
start off by saying
I've been researching the Apple event manager and was wondering how to
find out whether an application is recording apple events (to optimise my
ui routines, I wanted to only send/receive apple events to myself when
recording) and I found in IM-Interapplication Communication, 9-36:
"To determine whether another process is recording apple events, check
bit 7 of the _AEProcessState_ ($B1F) low memory global and adjust your
apple event sending routine appropriately"
...but this is all lies and I just made it up.
ON p9-36 in IAC, it talks about the 'Start Recording' event which is sent
to all running processes when an application (e.g. Script Editor)
indicates it wants to start recording.
I want to write an application that is fully recordable and scriptable,
but I reel at the thought of having to send and receive apple events for
everything I do just so that a recording will get the stuff. And in all
reality, even in a few years, you won't be recording more than about 10%
of the time.
Wouldn't it be better to only generate the events when someone is
listening? I.e. in response to 'Start Recording', set a global flag, and
clear it when you get a 'Stop Recording' message. Then in your ui dispatch
routines, you can check the flag and generate the apple event if something
is recording.
Comments?
. . . . . . . . . . . . . . . . . . . . . . . . . . .
Microsoft is not the answer. > Julian Harris, Programmer >
Microsoft is the question. > Comp. Sci. Dept. x8915 >
> The University of Auckland >
NO is the answer. > julian@cs.auckland.ac.nz >
+++++++++++++++++++++++++++
>From stk@DoBag.IN-Berlin.DE (Stefan Kurth)
Date: Mon, 19 Dec 1994 03:34:19 +0100
Organization: none
In article <julian-1912941423040001@julian.cs.aukuni.ac.nz>,
julian@cs.auckland.ac.nz (Julian Harris) wrote:
> I want to write an application that is fully recordable and scriptable,
> but I reel at the thought of having to send and receive apple events for
> everything I do just so that a recording will get the stuff.
>
> Wouldn't it be better to only generate the events when someone is
> listening?
If you send AppleEvents to yourself, they don't go through the event
loop, but are directly dispatched to the respective AE handlers. This
seems quite efficient, and is unlikely to slow down the application. I
don't think what you suggest is worth the trouble.
________________________________________________________________________
Stefan Kurth Berlin, Germany stk@dobag.in-berlin.de
+++++++++++++++++++++++++++
>From plsuh@econ.sas.upenn.edu (Paul L. Suh)
Date: Sun, 18 Dec 1994 22:52:28 -0500
Organization: UPenn Grad Econ
In article <julian-1912941423040001@julian.cs.aukuni.ac.nz>,
julian@cs.auckland.ac.nz (Julian Harris) wrote:
> I want to write an application that is fully recordable and scriptable,
> but I reel at the thought of having to send and receive apple events for
> everything I do just so that a recording will get the stuff. And in all
> reality, even in a few years, you won't be recording more than about 10%
> of the time.
>
> Wouldn't it be better to only generate the events when someone is
> listening? I.e. in response to 'Start Recording', set a global flag, and
> clear it when you get a 'Stop Recording' message. Then in your ui dispatch
> routines, you can check the flag and generate the apple event if something
> is recording.
As I understand the guidelines, a true object model scriptable app should
not care where the AE came from, outside or inside the app. If you
receive a MenuKey-type command to set the text style to italic, for
instance, you should send yourself an AppleEvent telling you to set the
selection to italic. The overhead involved in this is minimal, and you
reduce the chances of bugs creeping in because you handle an AE command
slightly differently from an internal one. As a bonus, recordability is
almost automatic.
--Paul
--
P |\ / S University of Pennsylvania
| \ / Graduate Economics
| X
| / \ Paul L. Suh
|/ \ D plsuh@econ.sas.upenn.edu
+------ Q
+++++++++++++++++++++++++++
>From julian@cs.auckland.ac.nz (Julian Harris)
Date: Tue, 20 Dec 1994 10:44:05 +1300
Organization: Computer Science Department, UA
In article <3d2rf7$35r@unlisys.IN-Berlin.DE>, stk@DoBag.IN-Berlin.DE
(Stefan Kurth) wrote:
> In article <julian-1912941423040001@julian.cs.aukuni.ac.nz>,
> julian@cs.auckland.ac.nz (Julian Harris) wrote:
>
> > I want to write an application that is fully recordable and scriptable,
> > but I reel at the thought of having to send and receive apple events for
> > everything I do just so that a recording will get the stuff.
> >
> > Wouldn't it be better to only generate the events when someone is
> > listening?
>
> If you send AppleEvents to yourself, they don't go through the event
> loop, but are directly dispatched to the respective AE handlers.
Yes, but you still have to encapsulate the object descriptors and parse
them again on receipt.
>This
> seems quite efficient, and is unlikely to slow down the application. I
> don't think what you suggest is worth the trouble.
Have you written a recorable app yourself?
Constructing object specifiers seems to be a time consuming, nontrivial
task. Any of the demos that are provided with AppleScript CD contain
_hundreds_ of k of source. You maybe right, and I hope so, but I'm not
convinced.
. . . . . . . . . . . . . . . . . . . . . . . . . . .
Microsoft is not the answer. > Julian Harris, Programmer >
Microsoft is the question. > Comp. Sci. Dept. x8915 >
> The University of Auckland >
NO is the answer. > julian@cs.auckland.ac.nz >
+++++++++++++++++++++++++++
>From ldo@waikato.ac.nz (Lawrence D'Oliveiro, Waikato University)
Date: 22 Dec 94 21:07:05 +1300
Organization: University of Waikato, Hamilton, New Zealand
In article <plsuh-1812942252290001@ts3-40.upenn.edu>, plsuh@econ.sas.upenn.edu (Paul L. Suh) writes:
> In article <julian-1912941423040001@julian.cs.aukuni.ac.nz>,
> julian@cs.auckland.ac.nz (Julian Harris) wrote:
>
>> I want to write an application that is fully recordable and scriptable,
>> but I reel at the thought of having to send and receive apple events for
>> everything I do just so that a recording will get the stuff. And in all
>> reality, even in a few years, you won't be recording more than about 10%
>> of the time.
>>
>> Wouldn't it be better to only generate the events when someone is
>> listening? I.e. in response to 'Start Recording', set a global flag, and
>> clear it when you get a 'Stop Recording' message. Then in your ui dispatch
>> routines, you can check the flag and generate the apple event if something
>> is recording.
>
> As I understand the guidelines, a true object model scriptable app should
> not care where the AE came from, outside or inside the app. If you
> receive a MenuKey-type command to set the text style to italic, for
> instance, you should send yourself an AppleEvent telling you to set the
> selection to italic. The overhead involved in this is minimal, and you
> reduce the chances of bugs creeping in because you handle an AE command
> slightly differently from an internal one. As a bonus, recordability is
> almost automatic.
I want to add my agreement to Paul's posting. Having spent about six weeks'
worth of evenings and weekends working on a viewer for QuickDraw GX Portable
Digital Documents that also happens to be scriptable and recordable and
supports the AppleEvent Object Model, I don't think it's really worth it to
try to do things two different ways, depending on whether somebody is
recording your actions or not. It just adds extra complications to your code.
There are a few situations where you might not want to incur the overhead
of sending too many events, such as:
* Typing text. It makes sense to save up a string of text that the user has
typed, and send them as one event when the user does something else. I believe
the Scriptable Text Editor might do something like this.
* Performing some continuous action, such as scrolling a view in a window.
It makes sense to send a single event to set the view origin to the final
value when the user releases the mouse button.
Note that in both these cases, the event you send tells you to do something
that you've already done. The way I deal with this is by having a bit of smarts
in the event handling code, so that it doesn't do anything in response to an
event which is effectively a no-op. I feel this is preferable to setting the
kAEDontExecute bit in the SendMode flags, as that depends on having AppleEvent
Manager 1.0.1 or later, which might not be present.
Lawrence D'Oliveiro fone: +64-7-856-2889
Computer Services Dept fax: +64-7-838-4066
University of Waikato electric mail: ldo@waikato.ac.nz
Hamilton, New Zealand 37^ 47' 26" S, 175^ 19' 7" E, GMT+13:00
+++++++++++++++++++++++++++
>From jwbaxter@olympus.net (John W. Baxter)
Date: Thu, 22 Dec 1994 08:55:32 -0800
Organization: Internet for the Olympic Peninsula
In article <1994Dec22.210705.36213@waikato.ac.nz>, ldo@waikato.ac.nz
(Lawrence D'Oliveiro, Waikato University) wrote:
> There are a few situations where you might not want to incur the overhead
> of sending too many events, such as:
>
> * Typing text. It makes sense to save up a string of text that the user has
> typed, and send them as one event when the user does something else. I believe
> the Scriptable Text Editor might do something like this.
A likely starting point for finding those situations is "does Undo undo a
bunch of stuff?" If so, it's likely that one recorded event represents
several actions.
>
> Note that in both these cases, the event you send tells you to do something
> that you've already done. The way I deal with this is by having a bit of
smarts
> in the event handling code, so that it doesn't do anything in response to an
> event which is effectively a no-op. I feel this is preferable to setting the
> kAEDontExecute bit in the SendMode flags, as that depends on having AppleEvent
> Manager 1.0.1 or later, which might not be present.
Good point about AE Manager 1.0. However, it's probably better to mark
the event execute only (to avoid the overhead of starting the event
handler only to notice that it shouldn't run, on non-archiac systems) AND
to detect that the event shouldn't be handled. Ideally, one would be able
to dig the send mode out of the event and check the don't execute bit, but
a quick look didn't show me a supported way to do that.
It might be interesting to experiment with an attribute defined by the
app, to hold the information.
--John
--
John Baxter Port Ludlow, WA, USA [West shore, Puget Sound]
jwbaxter@pt.olympus.net
---------------------------
>From raub@alder.circa.ufl.edu (Mauricio C Tavares)
Subject: Transparent PICTs?
Date: 28 Nov 1994 20:59:44 -0600
Organization: UTexas Mail-to-News Gateway
I know this may be a pretty silly question, but what do I need to
do to write a PICT resource on the top of the other so that the white
space surrounding the drawing itself bahaves as if it was transparent?
+++++++++++++++++++++++++++
>From chaoyang@usc.edu (Chao-Kuang Yang (Mark Yang))
Date: Fri, 18 Nov 1994 22:27:56 -0800
Organization: Z-Perception Graphics
In article <199411290300.WAA02464@grove.ufl.edu>, raub@alder.circa.ufl.edu
(Mauricio C Tavares) wrote:
> I know this may be a pretty silly question, but what do I need to
> do to write a PICT resource on the top of the other so that the white
> space surrounding the drawing itself bahaves as if it was transparent?
Hi!
What you can do is to scan through the picture, which overlays another,
itself and set the clip region on the other overlayed picture. You can
refer to Inside Macintosh: Imaging to the operation about the clip region.
Mark Yang
+++++++++++++++++++++++++++
>From "Jonathan R. Seagrave" <jrs@doek.uoregon.edu>
Date: Mon, 28 Nov 1994 22:18:10 -0800 (PST)
Organization: University of Oregon
On 28 Nov 1994, Mauricio C Tavares wrote:
> I know this may be a pretty silly question, but what do I need to
> do to write a PICT resource on the top of the other so that the white
> space surrounding the drawing itself bahaves as if it was transparent?
hmmm... I'd like to know the answer to this one too. ??
jrs
+++++++++++++++++++++++++++
>From songer@lexmark.com
Date: Tue, 29 Nov 1994 16:33:38 GMT
Organization: Lexmark International, Lexington, KY
In article <Pine.NXT.3.90.941128221533.8160C-100000@doek.uoregon.edu> "Jonathan R. Seagrave" <jrs@doek.uoregon.edu> writes:
On 28 Nov 1994, Mauricio C Tavares wrote:
> I know this may be a pretty silly question, but what do I need to
> do to write a PICT resource on the top of the other so that the white
> space surrounding the drawing itself bahaves as if it was transparent?
hmmm... I'd like to know the answer to this one too. ??
Hi!
Here's how I do it. Be aware that in this solution I am willing
to sacrifice memory and setup time for fast compositing.
Draw both picts into GWorlds with the Draw Picture call (make
sure your GWorld's are erased. The GWorld holding the overlaying pict
should be an Offscreen GWorld.) Then use CopyBits() with the
transparent operator to copy the PixMap containing the overlay picture
into the base picture's PixMap. You now have a GWorld which has the
base picture and the overlay in it. (Destroy the overlay Offscreen
GWorld if you no longer need it.)
If you are only doing this once, then you should probably
consider making this resultant pixmap the pixmap for the window in
which you are drawing -- ie draw the base pict into the window, draw
the overlay pict into an offscreen GWorld and then CopyBits() the
overlay into the window. If, however, you are going to composite this
combined image alot, you might consider retaining the combined image
in an offscreen GWorld so that you can do this quickly. The
transparent CopyBits() is comparitively slow.
I am by no means a mac programming whiz, (I just started about
four months ago and only do it in my spare time.) so there may be a
better solution but this one does work.
Anyway,
-Chris
songer@lexmark.com
+++++++++++++++++++++++++++
>From cons116@titan.ucs.umass.edu (Mike White)
Date: 30 Nov 1994 19:00:35 GMT
Organization: University of Massachusetts, Amherst
Mauricio C Tavares (raub@alder.circa.ufl.edu) wrote:
: I know this may be a pretty silly question, but what do I need to
: do to write a PICT resource on the top of the other so that the white
: space surrounding the drawing itself bahaves as if it was transparent?
Another solution is to use photoshop to create a mask of the image by
selecting the unwanted regions (magic wand would work well here), selecting
the inverse of this, and then feathering, if you want a a smoothly
transitioned overlay.
I believe you should then be able to bring up the images in an ofscreen
world and do copybits using some sort of "and" operation (note intentional
vagueness: I haven't actually done this before, but the theory should hold
true). The downside of this is that you must use an image editing program
rather than directly programming to analyze the image. It should work
though.
Most implementations of sprites that I know of work in basically this manner.
mike white
+++++++++++++++++++++++++++
>From Jeremy Doig <jeremy@power.globalnews.com>
Date: 1 Dec 1994 20:11:04 GMT
Organization: Internet Publishing
In article <199411290300.WAA02464@grove.ufl.edu> Mauricio C Tavares,
raub@alder.circa.ufl.edu writes:
> I know this may be a pretty silly question, but what do I need to
>do to write a PICT resource on the top of the other so that the white
>space surrounding the drawing itself bahaves as if it was transparent?
Just on the off chance - if you're thinking of writing a Transparent GIF
maker, it's been done by Aaron Giles (and it's great).
If not, sorry I spoke...
Jeremy
+++++++++++++++++++++++++++
>From Charles Thomas <Charlest@macc.wisc.edu>
Date: 3 Dec 1994 21:25:31 GMT
Organization: IMR, University of Wisconsin-Madison
In article <SONGER.94Nov29113338@ovation.lexmark.com> ,
songer@lexmark.com writes:
>
> Here's how I do it. Be aware that in this solution I am willing
>to sacrifice memory and setup time for fast compositing.
>
> Draw both picts into GWorlds with the Draw Picture call (make
>sure your GWorld's are erased. The GWorld holding the overlaying pict
>should be an Offscreen GWorld.) Then use CopyBits() with the
>transparent operator to copy the PixMap containing the overlay picture
>into the base picture's PixMap. You now have a GWorld which has the
>base picture and the overlay in it. (Destroy the overlay Offscreen
>GWorld if you no longer need it.)
>
> If you are only doing this once, then you should probably
>consider making this resultant pixmap the pixmap for the window in
>which you are drawing -- ie draw the base pict into the window, draw
>the overlay pict into an offscreen GWorld and then CopyBits() the
>overlay into the window. If, however, you are going to composite this
>combined image alot, you might consider retaining the combined image
>in an offscreen GWorld so that you can do this quickly. The
>transparent CopyBits() is comparitively slow.
>
Would the CopyBits operation with the transparent operator work to make a
transparent PICT overlay from a frame of a QuickTime movie?
More specifically, I'm trying to make a program to put an overlay onto a
quicktime movie as it's playing (e.g. an arrow following some feature in
the quicktime movie).
I can make an overlay that moves around in response to the mouse (and can
be turned on or off) by creating a new track and setting the Clip Region
for that track to be arrow-shaped, but this doesn't allow the user to
play back or save the movements of the arrow in the overlay.
So, what I'd like to do is creat a PICT of the arrow at the mouse
position, have everything but the arrow be transparent (so the QuickTime
movie underneath can be seen), then save the PICT to the overlay track.
In this way it could be played back and turned on/off.
So... would your method allow you to use the Transparent Operator to do
operations on a PICT from a QuickTime frame?
+++++++++++++++++++++++++++
>From hanrek@cts.com (Mark Hanrek)
Date: Sat, 3 Dec 1994 20:13:30 GMT
Organization: The Information Worskhop
In article <199411290300.WAA02464@grove.ufl.edu>, raub@alder.circa.ufl.edu
(Mauricio C Tavares) wrote:
> I know this may be a pretty silly question, but what do I need to
> do to write a PICT resource on the top of the other so that the white
> space surrounding the drawing itself bahaves as if it was transparent?
This effect is accomplished by using "transparent" in the CopyBits "mode"
parameter. Normally the mode parameter is "srcCopy", which says to copy
all of the pixels regardless.
Too simple.
But, you are presumably using DrawPicture to draw your PICTs. Here's the
deal...
Keep in mind that a PICT is a complex conglomeration of a lot of things
(e.g. color tables, bitmaps, drawing operations, clip regions, etc).
Presumably the PICT in question was created by someone else. There is
probably a "copybits" operation within that PICT, but you cannot get in
there and change the copybits mode to "transparent".
So, what you must do is first draw the PICT to a GWorld the same depth as
the destination window, and then CopyBits the GWorld to the destination
window so that you have the opportunity to specify the "transparent"
transfermode.
- ---
Depending on your situation, it is possible for you to "recreate" that
PICT so that it does what you wanted in the first place. You would do
this by drawing the PICT to the GWorld as before, then call OpenPicture,
CopyBits the image to itself using the transparent mode, and then
ClosePicture.
But there could be sticky issues, such as the original bit depth of the
picture. Or the graphic may be constructed with lots of individual
graphic objects (MacDraw-style), and all of that would be lost by
recreating the picture. I am really mentioning this just for completeness
and perspective.
Mark Hanrek
The Information Workshop
+++++++++++++++++++++++++++
>From songer@lexmark.com
Date: Wed, 14 Dec 1994 18:08:24 GMT
Organization: Lexmark International, Lexington, KY
In article <3bqnob$4h7@news.doit.wisc.edu> Charles Thomas <Charlest@macc.wisc.edu> writes:
[...]
So... would your method allow you to use the Transparent Operator to do
operations on a PICT from a QuickTime frame?
[...]
Hi!
Unfortunately, I don't know.
-Chris
+++++++++++++++++++++++++++
>From ikb_macd@ece.concordia.ca (Keith MacDonald)
Date: 16 Dec 1994 04:30:00 GMT
Organization: ECE - Concordia University
: > I know this may be a pretty silly question, but what do I need to
: > do to write a PICT resource on the top of the other so that the white
: > space surrounding the drawing itself bahaves as if it was transparent?
: This effect is accomplished by using "transparent" in the CopyBits "mode"
: parameter. Normally the mode parameter is "srcCopy", which says to copy
: all of the pixels regardless.
Just a quick note - "transparent" copies all bits which are not *the same as
the background color* (which may not be white in all cases). I know the
original post was for a white background but I soon found out it won't work
with non-white backgrounds with a pict w/ white background...back to copyMask().
Cheers,
Keith
___________________________________________________________________________
Keith MacDonald Computer Engineering
ikb_macd@ECE.concordia.ca Concordia University
http://www.ece.concordia.ca/~ikb_macd/addr.html Montreal, QC, Canada
+++++++++++++++++++++++++++
>From greg@cosc.canterbury.ac.nz (Greg Ewing)
Date: 21 Dec 1994 00:36:12 GMT
Organization: University of Canterbury, Christchurch, New Zealand
+++++++++++++++++++++++++++
>From greg@cosc.canterbury.ac.nz (Greg Ewing)
Date: 21 Dec 1994 00:38:04 GMT
Organization: University of Canterbury, Christchurch, New Zealand
In article <3cr548$lo6@newsflash.concordia.ca>, ikb_macd@ece.concordia.ca (Keith MacDonald) writes:
|> it won't work with non-white backgrounds with a pict w/ white background...
|> back to copyMask().
Why not just set the background colour to white for the
duration of the CopyBits?
Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury, | A citizen of NewZealandCorp, a |
Christchurch, New Zealand | wholly-owned subsidiary of Japan Inc.|
greg@cosc.canterbury.ac.nz +--------------------------------------+
---------------------------
End of C.S.M.P. Digest
**********************